package com.xnfh.home.viewmodel

import com.xnfh.common.bean.HomeStatisticsNum
import com.xnfh.common.bean.WeatherDetailBean
import com.xnfh.network.base.BaseRepository
import com.xnfh.framework.bean.RespStateData
import com.xnfh.common.bean.WeatherWarningBean
import com.xnfh.network.manager.ApiManager
import okhttp3.RequestBody

/**
 * @Description:
 * @Author: ziheng
 * @CreateDate: 2023/11/10 16:01
 * @UpdateUser: ziheng
 * @UpdateDate: 2023/11/10 16:01
 * @UpdateRemark: 更新说明
 */
class HomeRes : BaseRepository() {

    suspend fun requestWaetherWarning(
        requestBody: RequestBody,
        data: RespStateData<List<WeatherWarningBean>>
    ) =
        dealResp(
            { ApiManager.api.requestWaetherWarning(requestBody) }, data
        )

    suspend fun requestWeather(lonlats: String, data: RespStateData<WeatherDetailBean>) = dealResp(
        { ApiManager.api.requestWeather(lonlats) }, data
    )

    suspend fun requestFiledStatistics(statisticsNum: RespStateData<HomeStatisticsNum>) = dealResp(
        { ApiManager.api.requestFieldStatistics() }, statisticsNum
    )

}